/*
 * PropertyFactory.h
 *
 *  Created on: 09.08.2011
 *      Author: sili
 */

#ifndef PROPERTYFACTORY_H_
#define PROPERTYFACTORY_H_

#include "Controller.h"
#include "Property.h"

class PropertyFactory : public ActionListener{

private:
	string configDir;
	string propertyXmlFile;			// The property.xml file inside the configuration directory
	Controller * controller;
	//map<string,string> properties;
	vector<Property *> properties;

	void serializePropertyFile();
	void deSerializePropFile();

public:
	PropertyFactory(Controller * controller, const char * _configDir);
	virtual ~PropertyFactory();

	/**
	 * OVERWRITE
	 * I'm an ActionListener
	 */
	void doAction(AALAction * _action);
	void doMainSavedAction();

	Property * getProperty(const char * _name) throw(string);
	vector<Property *> getProperties();

	int getIntProperty(const char * _name, int _defaultValue = 0);
	double getDoubleProperty(const char * _name, double _defaultValue = 0.0);
	const char * getStringProperty(const char * _name, const char * _defaultValue = "");

	bool updateProperty(const char * _name, const char * _value, string * _response);
};

#endif /* PROPERTYFACTORY_H_ */
